//
//  TimeLineDateCell.m
//  PSYWeiBo
//
//  Created by xiaotian on 16/3/15.
//  Copyright © 2016年 郑亚田. All rights reserved.
//

#import "TimeLineDateCell.h"

@implementation TimeLineDateCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addAllViews];
    }
    
    return self;
}

- (void)addAllViews {
    self.iconImg = [UIImageView new];
    self.iconImg.image = [UIImage imageNamed:@"timeline-date-icon"];
    [self addSubview:self.iconImg];
    [self.iconImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(@5);
        make.top.equalTo(@0);
        make.height.width.equalTo(@60);
    }];
    self.iconImg.clipsToBounds = YES;
    self.iconImg.layer.cornerRadius = 30;
    
    self.timeLine = [UILabel new];
    self.timeLine.backgroundColor = [UIColor lightGrayColor];
    [self addSubview:self.timeLine];
    [self.timeLine mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.iconImg.mas_bottom);
        make.bottom.equalTo(@0);
        make.width.equalTo(@2);
        make.centerX.equalTo(self.iconImg.mas_centerX);
    }];
    
    self.idearLab = [UILabel new];
    [self addSubview:self.idearLab];
    [self.idearLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(@10);
        make.left.equalTo(self.iconImg.mas_right).with.offset(20);
        make.size.mas_equalTo(CGSizeMake(100, 25));
    }];
    self.idearLab.text = @"5则生活点滴";
    
    self.diaryLab = [UILabel new];
    [self addSubview:self.diaryLab];
    [self.diaryLab mas_makeConstraints:^(MASConstraintMaker *make) {
//        make.leading.mas_equalTo(self.idearLab.mas_leading);
//        make.size.mas_equalTo(self.idearLab.bounds.size);
        make.top.mas_equalTo(self.idearLab.mas_bottom);
        make.left.equalTo(self.iconImg.mas_right).with.offset(20);
        make.size.mas_equalTo(CGSizeMake(100, 25));
    }];
    self.diaryLab.text = @"2则日记";
    
    self.diary_countLab = [UILabel new];
    [self addSubview:self.diary_countLab];
    [self.diary_countLab mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.mas_equalTo(self.mas_centerY);
        make.right.equalTo(@-10);
        make.size.mas_equalTo(CGSizeMake(30, 25));
    }];
    self.diary_countLab.text = @" x 2";
    
    self.diaryImg = [UIImageView new];
    self.diaryImg.image = [UIImage imageNamed:@"letter-paper5"];
    [self addSubview:self.diaryImg];
    [self.diaryImg mas_makeConstraints:^(MASConstraintMaker *make) {
        make.trailing.mas_equalTo(self.diary_countLab.mas_leading);
        make.top.equalTo(@10);
//        make.size.mas_equalTo(CGSizeMake(50,80));
        make.bottom.equalTo(@-10);
        make.width.equalTo(@60);
    }];
    
    
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
